﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace BankRemoteSystem.BL
{
    class UserBO
    {
        public Entities.User login(String userName, String password)
        {
            DAL.UserAO user = new DAL.UserAO();

            SqlDataReader dr = user.getUserbyIDandPass(userName, password);
            if (dr.Read())
            {
                Entities.User c = new Entities.User();
                c.UserID = dr["userID"].ToString();
                c.Password = dr["password"].ToString();
                c.FullName = dr["fullName"].ToString();
                c.Email = dr["email"].ToString();
                c.Telephone = dr["telephone"].ToString();
                c.Gender = dr["gender"].ToString();
                c.Address = dr["address"].ToString();
                return c;
            }
            return null;
        }

        public void deteteUser(string userid)
        {
            DAL.UserAO dao = new DAL.UserAO();
            dao.deleteUser(userid);
        }
    }
}
